package com.codi.bus.core.dao.impl;

import com.codi.base.dao.BaseDAOImpl;
import com.codi.base.dao.v2.GeneratedBaseDaoImpl;
import com.codi.bus.core.dao.FundOptionalDao;
import com.codi.bus.core.domain.FundOptional;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by asus on 2017/12/6.
 */
@Repository("fundOptionalDao")
public class FundOptionalDaoImpl extends GeneratedBaseDaoImpl<FundOptional> implements FundOptionalDao {

    @Override
    public List<FundOptional> selectAll() {
        return this.findList(this.generateStatement("selectAll"),"");
    }

    @Override
    public List<FundOptional> selectFund(Long userId) {
        return this.findList(generateStatement("selectFund"),userId);
    }

    @Override
    public List<FundOptional> selectCurrency(Long userId) {
        return this.findList(generateStatement("selectCurrency"),userId);
    }

    @Override
    public List<FundOptional> selectByUserId(Long userId) {
        return this.findList(generateStatement("selectByUserId"),userId);
    }

    @Override
    public int deleteByUserIdAndCode(Long userId, String fundCode) {
        Map<String, Object> map = new HashMap<>();
        map.put("userId", userId);
        map.put("fundCode", fundCode);
        return this.delete(this.generateStatement("deleteByUserIdAndCode"), map);
    }
}
